package org.nowcoder.huawei.c100;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

/**
 * 16:虚拟游戏理财
 */

public class HC016 {
    public static void main(String[] args) {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        try {
            String[] vars = br.readLine().split(" ");
            int m = Integer.parseInt(vars[0]);
            int n = Integer.parseInt(vars[1]);
            int x = Integer.parseInt(vars[2]);

            vars = br.readLine().split(" ");
            int[] values = new int[m]; //投资回报率
            for (int i = 0; i < vars.length; i++) {
                values[i] = Integer.parseInt(vars[i]);
            }

            vars = br.readLine().split(" ");
            int[] risks = new int[m]; //投资风险值
            for (int i = 0; i < vars.length; i++) {
                risks[i] = Integer.parseInt(vars[i]);
            }

            vars = br.readLine().split(" ");
            int[] amounts = new int[m]; //最大投资额
            for (int i = 0; i < vars.length; i++) {
                amounts[i] = Integer.parseInt(vars[i]);
            }
            solve(values, risks, amounts, m, n, x);
        } catch (Exception ignored) {

        }
    }

    public static void solve(int[] values, int[] risks, int[] amounts, int m, int n, int x) {
        int max = Integer.MIN_VALUE; //最大投资汇报
        int[] results = null;
        //仅购买一个理财产品
        for (int i = 0; i < m; i++) {
            if (risks[i] < x) {
                int r = Math.min(amounts[i], n) * values[i];
                if (max <= r) {
                    int[] temp = new int[m];
                    temp[i] = Math.max(max, r);
                    results = temp;
                    max = r;
                }
            }
        }

        //购买两个理财产品
        for (int i = 0; i < m; i++) {
            for (int j = i + 1; j < m; j++) {
                if (risks[i] + risks[j] <= x) {
                    int r = amounts[i] * values[i] + amounts[j] * values[j];
                    if (max < r) {
                        int[] temp = new int[m];
                        temp[i] = amounts[i];
                        temp[j] = amounts[j];
                        results = temp;
                        max = r;
                    }
                }
            }
        }
        System.out.println(Arrays.toString(results));
    }
}
